
//HShin, 4/9/13

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class TaskObjList {
    public static <T extends TaskObj> T getById(List<T> TaskObjList, int id) {
    	for (T TaskObj : TaskObjList) {
    		if (TaskObj.getTaskId() == id) {
    			return TaskObj;
    		}
    	}
    	return null;
	}

    public static <T extends TaskObj> void sort(List<T> TaskObjList) {
    	Collections.sort(TaskObjList, new Comparator<T>() {
			public int compare(T a, T b) throws ClassCastException {
                Double cla = Double.valueOf(a.getTaskMemSize());
                Double clb = Double.valueOf(b.getTaskMemSize());
                return cla.compareTo(clb);  //return 0 if both objects are numerically equal
            }
		});
    }

}
